/**
 * 
 */
package com.teamall.web.fpgz.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.teamall.core.common.Page;
import com.teamall.core.convert.IArgConversionService;
import com.teamall.core.idproduce.ISequenceGenerator;
import com.teamall.framework.exception.BaseAppException;
import com.teamall.framework.log.LogManager;
import com.teamall.framework.util.Utils;
import com.teamall.web.fpgz.db.arg.CodeVillageTeamMemberArg;
import com.teamall.web.fpgz.db.arg.CodeVillageTeamMemberArg.CodeVillageTeamMemberCriteria;
import com.teamall.web.fpgz.db.dao.CodeVillageTeamMemberDao;
import com.teamall.web.fpgz.db.po.CodeVillageTeamMemberPO;
import com.teamall.web.fpgz.service.ICodeVillageTeamMemberService;

/**
 * <Description> <br>
 * 
 * @author codeCreater<br>
 * @version 1.0<br>
 * @taskId <br>
 * @CreateDate 2014年11月11日 <br>
 * @since V1.0<br>
 * @see com.teamall.web.fpgz.service.impl <br>
 */

@Service("codeVillageTeamMemberService")
public class CodeVillageTeamMemberServiceImpl implements ICodeVillageTeamMemberService {

	private static final LogManager logger = LogManager
			.getLogger(CodeVillageTeamMemberServiceImpl.class);

	@Autowired
	private CodeVillageTeamMemberDao codeVillageTeamMemberDao;

	/**
	 * 查询条件转换成Arg类的服务接口
	 */
	@Resource(name = "defaultArgConversionService")
	private IArgConversionService argConversionService;

	/**
	 * 主键生成器
	 */
	@Resource(name = "sequenceProcGenerator")
	private ISequenceGenerator sequenceGenerator;

	@Override
	public List<CodeVillageTeamMemberPO> selectByArg(CodeVillageTeamMemberPO record)
			throws BaseAppException {
		logger.debug("selectByArg begin...record={0}", record);

		// 第一种方式：自己创建arg，自行设置查询条件及操作符
		CodeVillageTeamMemberArg arg = new CodeVillageTeamMemberArg();
		CodeVillageTeamMemberCriteria criteria = arg.createCriteria();
		criteria.andVillageIdEqualTo(record.getVillageId());

		return codeVillageTeamMemberDao.selectByArg(arg);
	}

	@Override
	public Page<CodeVillageTeamMemberPO> selectByArgAndPage(CodeVillageTeamMemberPO record,
			Page<CodeVillageTeamMemberPO> resultPage) throws BaseAppException {
		logger.debug("selectByArgAndPage begin...record={0}", record);

		// 第一种方式：自己创建arg，自行设置查询条件及操作符
		CodeVillageTeamMemberArg arg = new CodeVillageTeamMemberArg();
		CodeVillageTeamMemberCriteria criteria = arg.createCriteria();
		criteria.andVillageIdEqualTo(record.getVillageId());

		resultPage = codeVillageTeamMemberDao.selectByArgAndPage(arg, resultPage);

		return resultPage;
	}

}
